downloads="downloads"
gopath="go"

if [ ! -d $downloads ];then
  mkdir $downloads
fi

if [ ! -d $gopath ];then
  mkdir $gopath
fi

# shellcheck disable=SC2164
cd $downloads

golangInstall=go1.14.7.linux-amd64.tar.gz

wget https://studygolang.com/dl/golang/$golangInstall
tar -zxvf $golangInstall

rm -rf /usr/local/share/go
mv go /usr/local/share

# shellcheck disable=SC2129
# shellcheck disable=SC2016
echo 'export PATH=$PATH:/usr/local/share/go/bin' >> /etc/profile
# shellcheck disable=SC2016
echo 'export PATH=$PATH:~/go/bin' >> /etc/profile
echo 'export GO111MODULE=on' >> /etc/profile
echo 'export GOPATH=~/go' >> /etc/profile
echo 'export GOPROXY=https://goproxy.cn' >> /etc/profile

source /etc/profile